#ifndef OVERNIGHT_STAY_TYPE_STRUCT_HH
#define OVERNIGHT_STAY_TYPE_STRUCT_HH 1


#include <string>
#include <iostream>
#include <vector>
#include "otl8.hpp"

static const char*  overnight_stay_type_struct_s = "SELECT ID, NAME, DESCR FROM OVERNIGHT_STAY_TYPE_STRUCT";

static const char*  overnight_stay_type_struct_i = "INSERT INTO OVERNIGHT_STAY_TYPE_STRUCT ( ID, NAME, DESCR )VALUES(:f1<int>, :f2<char[128]>, :f3<char[128]>)";

static const char* overnight_stay_type_struct_c = "CREATE TABLE OVERNIGHT_STAY_TYPE_STRUCT ( ID INTEGER , NAME VARCHAR(128) , DESCR VARCHAR(128) )";
class overnight_stay_type_struct
{



public:
overnight_stay_type_struct():_id(0), _name(""), _descr(""){_select=overnight_stay_type_struct_s;_insert=overnight_stay_type_struct_i;_create=overnight_stay_type_struct_c;}


overnight_stay_type_struct(int a__id, std::string a__name, std::string a__descr):_id(a__id) , _name(a__name) , _descr(a__descr) {_select=overnight_stay_type_struct_s;_insert=overnight_stay_type_struct_i;_create=overnight_stay_type_struct_c;}


int id(){return  _id;}
void set_id(int a__id){ _id = a__id;}


std::string name(){return  _name;}
void set_name(std::string a__name){ _name = a__name;}


std::string descr(){return  _descr;}
void set_descr(std::string a__descr){ _descr = a__descr;}


overnight_stay_type_struct & operator=( const overnight_stay_type_struct & x)
{
	_id =  x._id;
	_name =  x._name;
	_descr =  x._descr;
	return *this;
}


bool operator==( const overnight_stay_type_struct & x)
{
	return 	_id ==  x._id &&
	_name ==  x._name &&
	_descr ==  x._descr;
}


friend std::istream& operator >> (std::istream& ist, overnight_stay_type_struct & t)
{
	if (!(ist >> t._id)) return ist;
	if (!(ist >> t._name)) return ist;
	if (!(ist >> t._descr)) return ist;

	return ist;
}

friend std::ostream& operator << (std::ostream& ost, overnight_stay_type_struct & t)
{
	ost << t._id << " ";
	ost << t._name << " ";
	ost << t._descr << " ";

	return ost;
}

/*
friend otl_stream& operator >> (otl_stream& ist, overnight_stay_type_struct & t)
{
	ist >> t._id;
	ist >> t.buf; t._name=(const char*)t.buf;
	ist >> t.buf; t._descr=(const char*)t.buf;

	return ist;
}

friend otl_stream& operator << (otl_stream& ost, overnight_stay_type_struct & t)
{
	ost << t._id ;
	ost << t._name.c_str() ;
	ost << t._descr.c_str() ;

	return ost;
}
*/

std::string select_stmt() { return _select; }
std::string insert_stmt() { return _insert; }
std::string create_stmt() { return _create; }


private:

	int	_id;
	std::string	_name;
	std::string	_descr;
	std::string _create;
	std::string _select;
	std::string _insert;
char buf[128];
};
#endif
